import { http } from "@/utils/http";
import type { ResultProps } from "@/api/user";

export interface PersonProp {
  id?: number;
  accountId: number;
  businessId: number;
  name: string;
  personNo: null;
  gender: string;
  ethnicity: null;
  phone: string;
  idCard: null;
  education: null;
  birthday: Date;
  address: null;
  addressDetail: null;
  onboardingDate: null;
  expiryStart: null;
  expiryEnd: null;
  healthFrontUrl: null;
  healthBackUrl: null;
  idCardFrontUrl: null;
  idCardBackUrl: null;
  department: null;
  post: null;
  storeId: null;
  createTime: Date;
  updateTime: Date;
}

export const getPersonList = (data?: object) => {
  return http.requestJson<ResultProps<PersonProp[]>>(
    "post",
    "/personnel/getList",
    {
      data
    }
  );
};

export const personAdd = (data?: object) => {
  return http.requestJson<ResultProps<PersonProp[]>>("post", "/personnel/add", {
    data
  });
};

export const personUpd = (data?: object) => {
  return http.requestJson<ResultProps<PersonProp[]>>("post", "/personnel/upd", {
    data
  });
};

export const personDel = (data?: object) => {
  return http.requestJson<ResultProps<null>>("post", "/personnel/del", {
    data
  });
};
